<template>
  <div class="todo-footer">
    <label>
      <input
        type="checkbox"
        :checked="todos.length > 0 && todoIsDone.length === todos.length"
        @change="updataAllTodo($event.target.checked)"
      />
    </label>
    <span>
      <span>已完成{{ todoIsDone.length }}</span> / 全部{{ todos.length }}
    </span>
    <button class="btn btn-danger" @click="deleteAllDone">清除已完成任务</button>
  </div>
</template>

<script>
export default {
  props: {
    todos: Array,
    updataAllTodo: Function,
    deleteAllDone:Function
  },
  computed: {
    todoIsDone() {
      return this.todos.filter((item) => item.done);
    },
  },
};
</script>

<style>
</style>